package com.dhp.security.entity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * @ClassName: MyUserDetails
 * @Description: 自定义的实体类，实现于springsecurity框架的UserDetails
 * @Author: dhp
 * @Date: 2020/12/6 13:06
 * @Version: v1.0
 */
public class MyUserDetails implements UserDetails {
    private String username;
    private String password;
    private List<String> permissionValueList;

    public MyUserDetails(String username, String password, List<String> permissionValueList) {
        this.username = username;
        this.password = password;
        this.permissionValueList = permissionValueList;
    }

    public List<String> getPermissionValueList(){
        return permissionValueList;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
